/*
 * @Description: 引用数据类型
 * @Author: zzj
 * @Date: 2021-08-30 17:22:46
 * @LastEditors: zzj
 * @LastEditTime: 2021-08-30 17:49:23
 */

//对象是实例的描述
var obj = {
    name:"xiaoming",
    age:10,
    sex:"男",
    getName(){
        console.log(this.name);
    }
}
var stu = obj;   //浅拷贝 ：使用同一个地址
stu.age = 15;
console.log(obj.age);
//深拷贝
var stu2 = Object.assign([],obj);  //对象的合并
stu2 .sex ="女";
console.log(stu2);
console.log(obj);

var name1 = "xiaoming";
var name2 = name1;
name2 = "zhangsan";
console.log(name1);
// console.log(obj.name);
// obj.getName();  //前提是obj具有此项功能

//函数
function test(){
    //功能体
    var name = "herry";
    console.log(name);
}
test();
test();

//数组
// var arr = [1,"1",odj];
var arr = ["zs","ls","ww"];
console.log(arr);
console.log(arr[0]);   //获取数组的第一个元素
console.log(arr.length);  //获取数组的长度